#include <iostream>
using namespace std;

typedef struct demo01 {
    int arr[3] = {0};
}demo01;
typedef struct demo02 {
    int *arr = (int *)malloc(sizeof(int)*3);
}demo02;

void fun01(demo01 &demo01){
    //修改demo01.arr ==> 生效
}

void fun02(demo02 demo02){
    //修改demo02.arr ===> 生效
    demo02.arr[1] = 114514;
}


int main(){

    int arr[3] = {0,1,2};
    demo02 demo02;
    demo02.arr = arr;

    fun02(demo02);

    cout << "arr = ";
    for (int i = 0; i < 3; ++i) {
        cout<<arr[i]<<" ";
    }

    return 0;
}